Release 10.1A: OpenEdge Development:
Programming Interfaces


Example of changing values in the WRITER-STATUS attribute

Here is a code snippet (just the writer methods) that demonstrates the way that the WRITER-STATUS changes.

                                               /* hSAXWriter:WRITE-STATUS */ 
                                               /* SAX-WRITE-IDLE */ 
hSAXWriter:START-DOCUMENT().                   /* SAX-WRITE-BEGIN */ 
hSAXWriter:WRITE-COMMENT("comment").           /* SAX-WRITE-BEGIN */ 
hSAXWriter:START-ELEMENT("root", "").          /* SAX-WRITE-TAG */ 
hSAXWriter:START-ELEMENT("person", "").        /* SAX-WRITE-TAG */  
hSAXWriter:START-ELEMENT("name", "").          /* SAX-WRITE-TAG */  
hSAXWriter:WRITE-CHARACTERS("John").           /* SAX-WRITE-CONTENT */ 
hSAXWriter:END-ELEMENT("name", "").            /* SAX-WRITE-ELEMENT */ 
hSAXWriter:WRITE-EMPTY-ELEMENT("status", "").  /* SAX-WRITE-TAG */ 
hSAXWriter:INSERT-ATTRIBUTE("office", "1073"). /* SAX-WRITE-TAG */ 
hSAXWriter:END-ELEMENT("person", "").          /* SAX-WRITE-ELEMENT */ 
hSAXWriter:END-ELEMENT("root", "").            /* SAX-WRITE-ELEMENT */ 
hSAXWriter:END-DOCUMENT().                     /* SAX-WRITE-COMPLETE */ 

If STRICT is set to FALSE then calling a method while in the wrong state will not affect the XML document or the status of the writer. The method will not fail, the writer will write the data out, and the WRITE-STATUS will be set accordingly. WRITE-STATUS will only be set to SAX-WRITE-ERROR if there is a problem with the destination or proxml library at START-DOCUMENT.

If STRICT is set to TRUE then each of these invalid cases will return FALSE and an error message will be generated:

<method_name> invalid while WRITE-STATUS is <state_name>.

In this case the stream is closed and the WRITE-STATUS is change to SAX-WRITE-ERROR.

If there is a problem with the output destination or the proxml library, then regardless of the setting of STRICT, the WRITE-STATUS will be set to SAX-WRITE-ERROR. One of the following error messages will be generated:

Unable to write to output destination.

The proxml.dll or libproxml.so was missing or incomplete or XML could not be initialized.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095